<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0"><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />   
        <title>Welcome to Design Zone......</title>
        <link rel="stylesheet" type="text/css"
			href="../../scripts/ext/resources/css/ext-all.css" />
		<link rel="stylesheet" type="text/css"
			href="../../scripts/ext/resources/css/file-upload.css" />
		<link rel="stylesheet" type="text/css" href="../../styles/dzbase.css" />
		<script type="text/javascript"
			src="../../scripts/ext/adapter/ext-base.js">
		        </script>
		<script type="text/javascript" src="../../scripts/ext/ext-all.js">
        </script>
		<script type="text/javascript" src="../../scripts/form/FileUploadField.js">
        </script>
        <script type="text/javascript" src="../../scripts/grid/GroupSummary.js">
        </script>
        <script type="text/javascript" src="../../scripts/grid/RowExpander.js">
        </script>
        <script type="text/javascript" src="../../scripts/menu/EditableItem.js">
        </script>
        <script type="text/javascript" src="../../scripts/menu/RangeMenu.js">
        </script>
        <script type="text/javascript" src="../../scripts/grid/GridFilters.js">
        </script>
        <script type="text/javascript" src="../../scripts/grid/filter/Filter.js">
        </script>
        <script type="text/javascript" src="../../scripts/grid/filter/StringFilter.js">
        </script>
        <script type="text/javascript" src="../../scripts/grid/filter/DateFilter.js">
        </script>
        <script type="text/javascript" src="../../scripts/grid/filter/ListFilter.js">
        </script>
        <script type="text/javascript" src="../../scripts/i18nMessage.js">
        </script>
        <script type="text/javascript" src="../../scripts/utils.js">
        </script>
		<script type="text/javascript" src="../../scripts/selectBiFranceCustomer.js"></script>
		<script type="text/javascript" src="../../scripts/selectProductIdentification.js"></script>
		<script type="text/javascript" src="../../scripts/selectYarn.js"></script>
		<script type="text/javascript" src="../../scripts/selectDzColor.js"></script>
		<script type="text/javascript" src="../../scripts/selectOrderProduct.js"></script>
        <script type="text/javascript">
	        var piMessage = new i18nMessage('../../servlet/I18nMessageServlet?keyPrefix=ui.productidentification');
			var referenceMessage = new i18nMessage('../../servlet/I18nMessageServlet?keyPrefix=ui.reference');
			var yarnMessage = new i18nMessage('../../servlet/I18nMessageServlet?keyPrefix=ui.yarn');
	        var orderMessage = new i18nMessage('../../servlet/I18nMessageServlet?keyPrefix=ui.order');
			var fcMessage = new i18nMessage('../../servlet/I18nMessageServlet?keyPrefix=ui.francecustomer');
			var fMessage = new i18nMessage('../../servlet/I18nMessageServlet?keyPrefix=ui.factory');
	        var message = new i18nMessage('../../servlet/I18nMessageServlet?keyPrefix=message');
			var buttonMessage = new i18nMessage('../../servlet/I18nMessageServlet?keyPrefix=ui.accessorybutton');
			var colorMessage = new i18nMessage('../../servlet/I18nMessageServlet?keyPrefix=ui.pantonecolor');
			var dzColorMessage = new i18nMessage('../../servlet/I18nMessageServlet?keyPrefix=ui.dzcolor');
			var ctYesnoXmlLoader = new xmlLoader('../../servlet/CodeTableServlet?name=CtYesno');
			var ctOrderTypeXmlLoader = new xmlLoader('../../servlet/CodeTableServlet?name=CtOrderType');
			var ctSeasonNumberLoader = new xmlLoader('../../servlet/CodeTableServlet?name=CtSeasonNumber');
	
			var ctSeasonNumberStore = new Ext.data.Store({
	            reader: new Ext.data.XmlReader({
	                record: 'item',
	                id: 'code',
	                totalRecords: 'itemTotal'
	            }, [ 
	            'code', 'description']),
				data: ctSeasonNumberLoader.getXml()
	        });

			var ctYesnoStore = new Ext.data.Store({
                reader: new Ext.data.XmlReader({
                    record: 'item',
                    id: 'code',
                    totalRecords: 'itemTotal'
                }, ['code', 'description']),
                data: ctYesnoXmlLoader.getXml()
            });

	        var ctSeasonNumberCombo = new Ext.form.ComboBox({
	            fieldLabel: piMessage.get('ui.productidentification.seasonnumber'),
	            id: 'ctSeasonNumber',
	            name: 'ctSeasonNumber',
	            
	            blankText: message.get('message.edit.noblank'),
	            valueField: 'code',
	            typeAhead: true,
	            store: ctSeasonNumberStore,
	            displayField: 'description',
	            forceSelection: true,
	            triggerAction: 'all',
	            emptyText: message.get('message.combo.pleaseselect'),
	            selectOnFocus: true,
	            anchor: '80%',
	            mode: 'local',
				listeners: {
					select: {
						fn: function (thisComb, record,index){
	        				filter();
						}
					}
				}
	        });

	        var isYarnNeededCombo = new Ext.form.ComboBox({
                fieldLabel: orderMessage.get('ui.order.isyarnneeded'),
                id: 'isYarnNeeded',
                name: 'isYarnNeeded',
                
                blankText: message.get('message.edit.noblank'),
                editable: false,
                store: ctYesnoStore,
                valueField: 'code',
                displayField: 'description',
                triggerAction: 'all',
                emptyText: message.get('message.combo.pleaseselect'),
                selectOnFocus: true,
                anchor: '80%',
                mode: 'local',
				listeners: {
					select: {
						fn: function (thisCombo, record,index){
	        				if(isYarnNeededCombo.getValue() == '01'){
	        					isTimmingNeededCombo.setValue('02');
	        				}else{
	        					isTimmingNeededCombo.setValue('01');
	        				}
						}
					}
				}
            });

	        var isTimmingNeededCombo = new Ext.form.ComboBox({
                fieldLabel: orderMessage.get('ui.order.istrimmingneeded'),
                id: 'isTrimmingNeeded',
                name: 'isTrimmingNeeded',
                
                blankText: message.get('message.edit.noblank'),
                editable: false,
                store: ctYesnoStore,
                valueField: 'code',
                displayField: 'description',
                triggerAction: 'all',
                emptyText: message.get('message.combo.pleaseselect'),
                selectOnFocus: true,
                anchor: '80%',
                mode: 'local',
				listeners: {
					select: {
						fn: function (thisCombo, record,index){
	        				if(isTimmingNeededCombo.getValue() == '01'){
	        					isYarnNeededCombo.setValue('02');
	        				}else{
	        					isYarnNeededCombo.setValue('01');
	        				}
						}
					}
				}
            });
			
			var filter = function(){
				
			}


			var statisticsStore;
			var statisticsPanel;

			var selectFranceCustomerCallback = function(customerId, customerName, customerDepartment){
                document.getElementById('customerId').value = customerId;
                document.getElementById('customerName').value = customerName;
                document.getElementById('customerDepartment').value = customerDepartment;
                filter();
            }

			var selectedProductIdentification;
			var selectProductIdentificationCallback = function(){
            	Ext.getCmp('piId').setValue(selectedProductIdentification.id);
            	Ext.getCmp('piReference').setValue(selectedProductIdentification.reference);
            	//Ext.getCmp('ctSeasonNumber').setValue(selectedProductIdentification.ctSeasonNumber);
            	//document.getElementById('customerName').value = selectedProductIdentification['biFranceCustomer.name'];
                //document.getElementById('customerDepartment').value = selectedProductIdentification['biFranceCustomer.department'];
            	filter();
            }

			var selectedYarn = null;
			var selectYarnCallback = function(yarnId, yarnReference, factoryName, ctYarnMaterial1, ctYarnMaterial2, ctYarnMaterial3, ctYarnMaterial4, ctYarnMaterial5,ctYarnMeasure,yarnAccount){
				//alert(yarnId + ' ' + factoryName + ' ' +yarnReference+ ' ' +ctYarnMaterial1+ ' ' +ctYarnMaterial2+ ' ' +ctYarnMaterial3+ ' ' +ctYarnMaterial4+ ' ' +ctYarnMaterial5);
				document.getElementById('yarnId').value = yarnId;
				document.getElementById('yarnReference').value = yarnReference;
				Ext.getCmp('yarnAccount').setValue(ctYarnMeasure + yarnAccount);
				filter();
			}

			 var dzColorTipImg;
			 var selectedDZColor = null;
             var selectDZColorCallback = function(dzColorId, dzColorCode, customerName, customerDepartment, yarnReference, ctYarnMeasure, yarnAccount,
						supplierNumber, customerColorCode, pantoneNumber, realColor,
						ctYarnMaterial1, ctYarnMaterial2, ctYarnMaterial3, ctYarnMaterial4, ctYarnMaterial5, factoryName, photo1Name, photo2Name,photo3Name,isApproved){
					if(isApproved == '02'){
						messageTip.msg(message.get('message.tip'), orderMessage.get('ui.order.colornotapproved'));
						return;
					}
					Ext.getCmp('dzColorId').setValue(dzColorId);
					Ext.getCmp('dzColorCode').setValue(dzColorCode);
					//Ext.getCmp('customerName').setValue(customerName);
					//Ext.getCmp('customerDepartment').setValue(customerDepartment);
					
					//Ext.getCmp('supplierNumber').setValue(supplierNumber);
					Ext.getCmp('customerColorCode').setValue(customerColorCode);
					dzColorTipImg = photo3Name;
					//Ext.getCmp('pantoneNumber').setValue(pantoneNumber);
					//if(realColor && realColor != '')
					//	document.getElementById('sampleTable').style['backgroundColor'] = '#' + realColor;
					//else
					//	document.getElementById('sampleTable').style['backgroundColor'] = '#DFE8F6';
					//Ext.getCmp('factoryName').setValue(factoryName);
					//Ext.getCmp('customerName').setValue(selectedDZColor['biFranceCustomer.name']);
					//Ext.getCmp('customerDepartment').setValue(selectedDZColor['biFranceCustomer.department']);
					//Ext.getCmp('yarnReference').setValue(selectedDZColor.yarnReference);
					//Ext.getCmp('yarnAccount').setValue(selectedDZColor.ctYarnMeasure + selectedDZColor.yarnAccount);
					filter();
				}

				var selectOrderProductCallback = function(orderProductId, orderNumber){
					Ext.getCmp('orderProductId').setValue(orderProductId);
					Ext.getCmp('orderNumber').setValue(orderNumber);
					filter();	
				}
				
            Ext.onReady(function(){
                Ext.QuickTips.init();
				
				Ext.form.Field.prototype.msgTarget = 'side';
				
				statisticsStore = new Ext.data.GroupingStore({
                    reader: new Ext.data.XmlReader({
                        record: 'item',
                        id: 'id',
                        totalRecords: 'itemTotal'
                    }, [ 
                    'ctSeasonNumber', 'orderNumber','variant','customerName', 'customerDepartment', 'piReference','yarnReference', 'yarnAccount','ctSupplyType',
					'dzColorCode', 'customerColorCode', {name:'yarnNeeded',type:'float'}, 'trimmingDZReference', 'trimmingCustomerReference',{name:'trimmingNeeded',type:'int'}]),
                    
                    remoteSort: false
                });
				
				var summary = new Ext.grid.GroupSummary();
				statisticsPanel = new Ext.Panel({
			        frame:true,
					bodyStyle:'padding:5px 5px 5px 5px;margin-top: 2px;',
			        width:'100%',
					labelWidth: 105,
			        title: orderMessage.get('ui.order.statistics'),
			        items: [{
				        id : 'customerId',
				        name : 'customerId',
				        xtype : 'hidden'
			        },{
                        id: 'piId',
                        name: 'piId',
                        xtype: 'hidden'
                    },{
                        id: 'yarnId',
                        name: 'yarnId',
                        xtype: 'hidden'
                    },{
                        id: 'dzColorId',
                        name: 'dzColorId',
                        xtype: 'hidden'
                    },{
                        id: 'orderProductId',
                        name: 'orderProductId',
                        xtype: 'hidden'
                  },{
						layout: 'column',
						items: [{
							columnWidth:.33,
			                layout: 'form',
							items: [{
								id: 'date',
	                            name: 'date',
	                            fieldLabel: message.get('message.edit.date')+ "(d/m/Y)",
	                            xtype: 'datefield',
	                            anchor: '80%',
	                            
	                            blankText: message.get('message.edit.noblank'),
	                            maxLength: 128
	                        }, ctSeasonNumberCombo,{
                               	id:'piReference',
                                   name: 'piReference',
                                   fieldLabel: piMessage.get('ui.productidentification.chart'),
                                   xtype: 'textfield',
                                   anchor: '86%',
                                   emptyText: message.get('message.combo.pleaseselect'),
                                   blankText: message.get('message.edit.noblank'),
                                   
                                   readOnly: true,
                                   listeners: {
                                       'render': {
                                           fn: function(){
                                               Ext.getCmp('piReference').getEl().on('click', function(){
                                                   selectProductIdentification(selectProductIdentificationCallback, '', '');
                                               }, this);
                                           },
                                           scope: this
                                       }
                                   }
                               },{
                                id: 'dzColorCode',
                                name: 'dzColorCode',
                                fieldLabel: dzColorMessage.get('ui.dzcolor.code') + '&nbsp;&nbsp;&nbsp;&nbsp;<img id="dzColorTip" src="../../images/icons/images.png"/>',
                                xtype: 'textfield',
                                
                                blankText: message.get('message.edit.noblank'),
                                emptyText: message.get('message.combo.pleaseselect'),
                                anchor: '86%',
                                width: '90%',
                                maxLength: 64,
								readOnly: true,
								listeners: {
                                        'render': {
                                            fn: function(){
                                                Ext.getCmp('dzColorCode').getEl().on('click', function(){
                                                    selectDZColor(selectDZColorCallback, null, null, null, null, null);
                                                }, this);
                                            },
                                            scope: this
                                        }
                                    }
                            },{
                               	id: 'orderNumber',
	                            name: 'orderNumber',
	                            fieldLabel: piMessage.get('ui.productidentification.ordernumber'),
	                            xtype: 'textfield',
	                            anchor: '86%',
	                            
	                            readOnly: true,
	                            emptyText: message.get('message.combo.pleaseselect'),
	                            blankText: message.get('message.edit.noblank'),
								listeners: {
                                       'render': {
                                           fn: function(){
                                               Ext.getCmp('orderNumber').getEl().on('click', function(){
                                               	selectOrderProduct(selectOrderProductCallback);
                                               }, this);
                                           },
                                           scope: this
                                       }
                                   }
	                        },isYarnNeededCombo]
						},{
							columnWidth:.33,
			                layout: 'form',
							items: [{html: '<div class="div"><label class="x-form-item-label">&nbsp;</label></div><br/>'},{
                                   id: 'customerName',
                                   name: 'customerName',
                                   fieldLabel: message.get('message.edit.customername'),
                                   xtype: 'textfield',
                                   anchor: '86%',
                                   
                                   blankText: message.get('message.edit.noblank'),
                                   emptyText: message.get('message.combo.pleaseselect'),
                                   readOnly: true,
                                   maxLength: 64,
                                   listeners: {
                                       'render': {
                                           fn: function(){
                                               Ext.getCmp('customerName').getEl().on('click', function(){
                                                   selectFranceCustomer(selectFranceCustomerCallback);
                                               }, this);
                                           },
                                           scope: this
                                       }
                                   }
                               },{
                                id: 'yarnReference',
                                name: 'yarnReference',
                                xtype: 'textfield',
                                fieldLabel: yarnMessage.get('ui.yarn.reference'),
                                anchor: '86%',
								width: '90%',
                                
                                blankText: message.get('message.edit.noblank'),
								emptyText: message.get('message.combo.pleaseselect'),
                                maxLength: 64,
                                maxLengthText: message.get('message.edit.toolong'),
								readOnly: true,
                                listeners: {
                                    'render': {
                                        fn: function(){
                                            Ext.getCmp('yarnReference').getEl().on('click', function(){
                                                selectYarn(selectYarnCallback);
                                            }, this);
                                        },
                                        scope: this
                                    }
                                }
                            },{
								id: 'customerColorCode',
                                   name: 'customerColorCode',
                                   fieldLabel: dzColorMessage.get('ui.dzcolor.customercolorcode'),
                                   xtype: 'textfield',
                                   anchor: '86%',
								width: '90%',
                                   blankText: message.get('message.edit.noblank'),
                                   maxLength: 256,
							    readOnly: true
                               },{html: '<div class="div"><label class="x-form-item-label">&nbsp;</label></div><br/>'},isTimmingNeededCombo]
						},{
							columnWidth:.33,
			                layout: 'form',
							items: [{html: '<div class="div"><label class="x-form-item-label">&nbsp;</label></div><br/>'},{
                                   xtype: 'textfield',
                                   fieldLabel: fcMessage.get('ui.francecustomer.department'),
                                   id: 'customerDepartment',
                                   name: 'customerDepartment',
                                   anchor: '86%',
                                   allowBlank: true,
                                   blankText: message.get('message.edit.noblank'),
                                   readOnly: true,
                                   maxLength: 64,
                                   tabIndex: 1
                               },{
								id: 'yarnAccount',
                                   name: 'yarnAccount',
                                   fieldLabel: yarnMessage.get('ui.yarn.yarnaccount'),
                                   xtype: 'textfield',
                                   anchor: '86%',
								width: '90%',
								readOnly: true,
                                   maxLength: 64
                               },{html: '<div class="div"><label class="x-form-item-label">&nbsp;</label></div><br/>'},{html: '<div class="div"><label class="x-form-item-label">&nbsp;</label></div>'},
                               {html: '<table style="margin-top: 10px;"><tr><td><div id="calculateBtn"/></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td><div id="printBtn"/></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td><div id="resetBtn"/></td></tr></table>'}
                               ]
						}]
                   	},new Ext.grid.GridPanel({
                        store: statisticsStore,
    					stripeRows: true,
    					plugins: [summary],
                        height: 560,
                        columns: [{
                            header: piMessage.get('ui.productidentification.seasonnumber'),
                            dataIndex: 'ctSeasonNumber',
                            sortable: true
                        }, {
                            header: message.get('message.edit.customername'),
                            dataIndex: 'customerName',
                            sortable: true
                        }, {
                            header: fcMessage.get('ui.francecustomer.department'),
                            dataIndex: 'customerDepartment',
                            sortable: true
                        }, {
                            header: piMessage.get('ui.productidentification.chart'),
                            dataIndex: 'piReference',
                            sortable: true
                        }, {
                            header: piMessage.get('ui.productidentification.ordernumber'),
                            dataIndex: 'orderNumber',
                            sortable: true
                        }, {
                            header: dzColorMessage.get('ui.dzcolor.variant'),
                            dataIndex: 'variant',
                            sortable: true
                        }, {
                            header: yarnMessage.get('ui.yarn.reference'),
                            dataIndex: 'yarnReference',
                            sortable: true
                        }, {
                            header: yarnMessage.get('ui.yarn.yarnaccount'),
                            dataIndex: 'yarnAccount',
                            sortable: true
                        }, {
                            header: dzColorMessage.get('ui.dzcolor.code'),
                            dataIndex: 'dzColorCode',
                            sortable: true
                        }, {
                            header: dzColorMessage.get('ui.dzcolor.customercolorcode'),
                            dataIndex: 'customerColorCode',
                            sortable: true
                        }, {
                            header: orderMessage.get('ui.order.trimmingreference'),
                            dataIndex: 'trimmingDZReference',
                            sortable: true
                        }, {
                            header: orderMessage.get('ui.order.trimmingcustomerreference'),
                            dataIndex: 'trimmingCustomerReference',
                            sortable: true,
                            summaryRenderer:function(){
                            	return '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+message.get('message.list.total');
                            }
                        }, {
                            header: orderMessage.get('ui.order.isyarnneeded') + '(Kg)',
                            dataIndex: 'yarnNeeded',
                            sortable: true,
                            align:'right',
                            renderer: render3D,
                            summaryType:'sum' 
                        }, {
                            header: orderMessage.get('ui.order.istrimmingneeded'),
                            dataIndex: 'trimmingNeeded',
                            sortable: true,
                            align:'right',
                            renderer: render0D,
                            summaryType:'sum'
                        },{
                            header: message.get('message.edit.buyer'),
                            dataIndex: 'ctSupplyType',
                            sortable: true
                        }],
                        view: new Ext.grid.GroupingView({
	                        forceFit: true,
							hideGroupedColumn: false,
							enableNoGroups:false,
	                        groupTextTpl: '{text}'
	                    }),
                        loadMask: true
                    })],
			        renderTo: 'statisticsPanel'
			    });

				var dzColorTip = new Ext.ToolTip({
			        target: 'dzColorTip',
			        html: '<img id="dzColorTipImg" src="../../_temp/noimage.gif" width="150px">',
			        title: orderMessage.get('ui.order.approvedpic'),
			        autoHide: true,
			        closable: true,
			        draggable:true
			    });
			    
			    dzColorTip.on('show', function(){
			    	if(dzColorTipImg){
			    		document.getElementById('dzColorTipImg').src =  '../../_temp/' + dzColorTipImg;
			    	}
			    });

				var getUrlApp = function(){
					var hiddenFields = statisticsPanel.findByType('hidden');
    				var comboBoxs = statisticsPanel.findByType('combo');
    				var dateFields = statisticsPanel.findByType('datefield');
    				
    				var urlApp = '';
    				for(var i = 0; i < hiddenFields.length; i ++){
			    		if(hiddenFields[i].getValue())
				    		urlApp += ('&' + hiddenFields[i].getId() + '=' + hiddenFields[i].getValue())
					}
    				for(var i = 0; i < comboBoxs.length; i ++){
			    		if(comboBoxs[i].getValue() && comboBoxs[i].getId() != 'isYarnNeeded' && comboBoxs[i].getId() != 'isTrimmingNeeded')
				    		urlApp += ('&' + comboBoxs[i].getId() + '=' + comboBoxs[i].getValue())
					}
    				for(var i = 0; i < dateFields.length; i ++){
			    		if(dateFields[i].getValue())
				    		urlApp += ('&' + dateFields[i].getId() + '=' + dateFields[i].getValue().format('d/m/Y'));
					}
    				if(urlApp == ''){
    					messageTip.msg(message.get('message.tip'), message.get('message.edit.selectcondition'));
						return;
					}
					if(!Ext.getCmp('isYarnNeeded').getValue() && !Ext.getCmp('isTrimmingNeeded').getValue()){
						messageTip.msg(message.get('message.tip'),  message.get('message.edit.selectyarnneed'));
						return;
					}
					if(Ext.getCmp('isYarnNeeded').getValue() == '02' && Ext.getCmp('isTrimmingNeeded').getValue() == '02'){
						return;
					}
					if(!Ext.getCmp('isYarnNeeded').getValue()&& Ext.getCmp('isTrimmingNeeded').getValue() == '02'){
						return;
					}
					if(Ext.getCmp('isYarnNeeded').getValue() == '02' && !Ext.getCmp('isTrimmingNeeded').getValue()){
						return;
					}
					urlApp += ('&isYarnNeeded=' + (Ext.getCmp('isYarnNeeded').getValue()==''?'02':Ext.getCmp('isYarnNeeded').getValue()));
					urlApp += ('&isTrimmingNeeded=' + (Ext.getCmp('isTrimmingNeeded').getValue()==''?'02':Ext.getCmp('isTrimmingNeeded').getValue()));
					return urlApp;
				}
			    
			    new Ext.Button({
			    	renderTo: 'calculateBtn',
			        text: message.get('message.list.calculate'),
			        listeners : {
						click: {
							fn: function (){
								var urlApp = getUrlApp();
								if(!urlApp){
									return;
								}
    				
								url = '../../servlet/OrderProductServlet?action=20';
								url += urlApp;

								statisticsStore.proxy = new Ext.data.HttpProxy({
									url : url
								});
								
								if(isYarnNeededCombo.getValue() == '01'){
									statisticsStore.setDefaultSort('dzColorCode', 'asc');
									statisticsStore.groupBy('dzColorCode', true);
								}else{
									statisticsStore.setDefaultSort('trimmingDZReference', 'asc');
									statisticsStore.groupBy('trimmingDZReference', true);
								}	
								statisticsStore.load({
									callback : function(r, options, success) {
										if (success){
																				
										}
									}
								});
							}
					}
				}
			    });

			    new Ext.Button({
			    	renderTo: 'printBtn',
			        text: message.get('message.list.print'),
			        listeners : {
						click: {
							fn: function (){
						    	var urlApp = getUrlApp();
								if(!urlApp){
									return;
								}
    							window.open('../../servlet/PDFExportServlet?action=2' + urlApp);
							}
						}
					}
			    });

			    new Ext.Button({
			    	renderTo: 'resetBtn',
			        text: message.get('message.edit.reset'),
			        listeners : {
						click: {
							fn: function (){
						    	var textFields = statisticsPanel.findByType('textfield');
								for(var i = 0; i < textFields.length; i ++){
									textFields[i].setValue('');
								}
						    	
						    	var comboBoxs = statisticsPanel.findByType('combo');
						    	for(var i = 0; i < comboBoxs.length; i ++){
						    		comboBoxs[i].setValue('');
								}
						    	
						    	var hiddenFields = statisticsPanel.findByType('hidden');
						    	for(var i = 0; i < hiddenFields.length; i ++){
						    		hiddenFields[i].setValue('');
								}
								
						    	var dateFields = statisticsPanel.findByType('datefield');
						    	for(var i = 0; i < dateFields.length; i ++){
						    		dateFields[i].setValue('');
								}
							}
					}
			    }
			    });
			});
        </script>
</head>
<body>
	<div id="statisticsPanel"></div>
</body>
</html>